﻿using System.Collections;
using System.Collections.Specialized;
using System.ComponentModel;

namespace MugenMvvmToolkit.Models
{
    /// <summary>
    ///     Provides data for the CollectionChanging event.
    /// </summary>
    public class NotifyCollectionChangingEventArgs : CancelEventArgs
    {
        #region Properties

        internal NotifyCollectionChangedEventArgs ChangedEventArgs { get; set; }

        #endregion
        
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="NotifyCollectionChangingEventArgs"/> class.
        /// </summary>
        public NotifyCollectionChangingEventArgs(NotifyCollectionChangedEventArgs changedEventArgs)
        {
            ChangedEventArgs = changedEventArgs;
        }

        #endregion

        #region Properties

        /// <summary>
        /// The action that caused the event. 
        /// </summary>
        public NotifyCollectionChangedAction Action
        {
            get { return ChangedEventArgs.Action; }
        }

        /// <summary>
        /// The items affected by the change.
        /// </summary> 
        public IList NewItems
        {
            get { return ChangedEventArgs.NewItems; }
        }

        /// <summary>
        /// The old items affected by the change (for Replace events).
        /// </summary>
        public IList OldItems
        {
            get { return ChangedEventArgs.OldItems; }
        }

        /// <summary> 
        /// The index where the change occurred.
        /// </summary>
        public int NewStartingIndex
        {
            get { return ChangedEventArgs.NewStartingIndex; }
        }

        /// <summary>
        /// The old index where the change occurred (for Move events). 
        /// </summary>
        public int OldStartingIndex
        {
            get { return ChangedEventArgs.OldStartingIndex; }
        }

        #endregion
    }
}